package top.ranzhang.controller.admin;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.ranzhang.bean.vo.ChildSexCountVO;
import top.ranzhang.bean.vo.CoashClazzCountVO;
import top.ranzhang.common.result.Result;
import top.ranzhang.service.*;

/**
 * 数据统计
 * @author ranzhang
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/dataStatistics")
public class DataStatisticsController {

    private final ICoashService coashService;
    private final IChildService childService;
    private final IParentCommunicationsService communicationService;
    private final ITeachingResourcesService TeachingResourcesService;
    private final IAttendanceRecordsService attendanceRecordsService;

    /**
     * 获取教师上课次数统计
     * @return
     */
    @GetMapping("/ClazzCount")
    public Result<CoashClazzCountVO> getCoashClazzCount(){
        CoashClazzCountVO coashClazzCountVO = coashService.getCoashClazzCount();
        return Result.success(coashClazzCountVO);
    }

    /**
     * 获取学生性别统计
     * @return
     */
    @GetMapping("/ChildSexCount")
    public Result<ChildSexCountVO> getChildSexCount(){
        ChildSexCountVO childSex = childService.getChildSexCount();
        return Result.success(childSex);
    }

    /**
     * 获取每日交流次数
     * @return
     */
    @GetMapping("/CommunicationCount")
    public Result<Integer> getCommunicationCount(){
        Integer communicationCount = communicationService.getCommunicationCount();
        return Result.success(communicationCount);
    }

    /**
     * 资源数量
     */
    @GetMapping("/ResourceCount")
    public Result<Integer> getResourceCount(){
        Integer communicationCount = TeachingResourcesService.getResourceCount();
        return Result.success(communicationCount);
    }
    /**
     * 获取每日出勤次数
     * @return
     */
    @GetMapping("/AttendanceCount")
    public Result<Integer> getAttendanceCount(){
        Integer communicationCount = attendanceRecordsService.getAttendanceCount();
        return Result.success(communicationCount);
    }
}
